<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
	<!--<link rel="stylesheet" href="css/bootstrap.min.css" >-->
	<link rel="stylesheet" href="https://leanprover-community.github.io//css/lean.css" >
	<link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Merriweather:700">
    

	<script>
                function buildShortcutsForStructures(names) { 
                        const o = {}
                        names.forEach(name => o[name] = `\\mathbb\{${name}\}`)
                        return o
                }
		MathJax = {
			  tex: {
                                  macros: {
                                          ...buildShortcutsForStructures(["R", "Q", "Z", "N", "C"]),
                                  },
				      inlineMath: [['$', '$'], ['\\(', '\\)']]
				    },
		};
	</script>
	<script type="text/javascript" id="MathJax-script" async
		  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
	</script>

	<title>Controlled installation of Lean and mathlib on Debian/Ubuntu</title>
  </head>
  <body>
  <div id="wrapper">
  <nav class="navbar navbar-expand-lg navbar-light bg-gradient-light">
    <div class="d-flex flex-grow-1">
		<a class="navbar-brand" href="https://leanprover-community.github.io/index.html">Lean Community
    </a>
    </div>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse flex-grow-1 text-right" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto">
		
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
			  Try it!
          </a>
		  <div class="dropdown-menu " aria-labelledby="navbarDropdown">
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/lean-web-editor">Lean online</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/get_started.html">Install</a>
			
			
          </div>
        </li>
		
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
			  Learn
          </a>
		  <div class="dropdown-menu  dropdown-menu-right" aria-labelledby="navbarDropdown">
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/learn.html">Resources</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover.github.io/theorem_proving_in_lean/">Theorem proving in Lean</a>
			
			
			
			<a class="dropdown-item" href="http://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game/">The natural number game</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/mathlib-overview.html">Library overview</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/mathlib_docs">API documentation</a>
			
			
          </div>
        </li>
		
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
			  Community
          </a>
		  <div class="dropdown-menu  dropdown-menu-right" aria-labelledby="navbarDropdown">
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/meet.html">Meet us</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover.zulipchat.com/">Zulip chat</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/meet.html#maintainers">Maintainers</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/contribute/index.html">How to contribute</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/papers.html">Papers</a>
			
			
          </div>
        </li>
		
      </ul>
    </div>
  </nav>
  <div class="container-sm mt-4">
	  
<h1 id="controlled-installation-of-lean-and-mathlib-on-debianubuntu" class="markdown-heading">Controlled installation of Lean and mathlib on Debian/Ubuntu <a class="hover-link" href="#controlled-installation-of-lean-and-mathlib-on-debianubuntu">#</a></h1>
<p>This document explains a more controlled installation procedure
for Lean and mathlib on Linux distributions derived from Debian (Debian itself,
Ubuntu, LMDE,...). There is a quicker way described in the main
<a href="debian.html">install page</a> but it requires more trust.
Of course you can get even more details about what is going on by
reading the bash script that will be downloaded below:
<a href="https://github.com/Kha/elan/blob/master/elan-init.sh">elan_init</a>.</p>
<ul>
<li>
<p>Lean itself doesn't depend on much infrastructure, but supporting tools
needed by most users require <code>git</code>, <code>curl</code>, and <code>python</code>. So the first step is:</p>
<pre><code class="language-bash">sudo apt install git curl python3 python3-pip python3-venv
</code></pre>
</li>
<li>
<p>The next step installs a small tool called <code>elan</code> which will handle
updating Lean according to the needs of your current project (hit Enter
when a question is asked). It will live in <code>$HOME/.elan</code> and adds a
line to <code>$HOME/.profile</code>.</p>
<pre><code class="language-bash">curl https://raw.githubusercontent.com/Kha/elan/master/elan-init.sh -sSf | sh
</code></pre>
</li>
<li>
<p>There are two editors you can use with Lean, VS Code and emacs. The
recommended choice is <a href="https://code.visualstudio.com/">Visual Studio Code</a>.</p>
<pre><code class="language-bash">wget -O code.deb https://go.microsoft.com/fwlink/?LinkID=760868
sudo apt install ./code.deb
rm code.deb
code --install-extension jroesch.lean
</code></pre>
<p>Now open VS Code, and verify Lean is working, for example by saving a file <code>test.lean</code> and entering <code>#eval 1+1</code>.
A green line should appear underneath <code>#eval 1+1</code>, and hovering the mouse over it you should see <code>2</code>
displayed.</p>
<p>The alternative is to use Emacs, and its <a href="https://github.com/leanprover/lean-mode">lean-mode</a>.</p>
</li>
<li>
<p>Then we install a small tool called <code>leanproject</code> that which will handle
updating mathlib according to the needs of your current project. We use
<a href="https://pipxproject.github.io/pipx/">pipx</a> to perform the installation.</p>
<pre><code class="language-bash">python3 -m pip install --user pipx
python3 -m pipx ensurepath
source ~/.profile
pipx install mathlibtools
</code></pre>
</li>
</ul>
<h2 id="lean-projects" class="markdown-heading">Lean Projects <a class="hover-link" href="#lean-projects">#</a></h2>
<p>You can now read instructions about creating and working on <a href="project.html">Lean projects</a></p>

  </div>
</div>

  <nav class="footer navbar navbar-expand-lg navbar-light bg-light justify-content-end">
  <ul class="nav">
    <li class="nav-item">
      <a class="nav-link active" href="https://github.com/leanprover-community/leanprover-community.github.io/blob/newsite/templates/install/debian_details.md">Suggest edits to this page on GitHub</a>
    </li>
  </ul>
</nav>

    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="https://leanprover-community.github.io//js/bootstrap.min.js"></script>
    
  </body>
</html>